//#########################################################################
//                              WackiEngie
//           Copyright (c) 2014 Marc Wacker. All rights reserved.
//#########################################################################

#pragma once

#include "WeCorePrerequisites.h"

namespace WackiEngine
{

	class Image
	{
	public:
		Image();
		Image(const String& fileName);
		~Image();

		// load an image, returns the data on success, NULL otherwise
		void*			load(const String& fileName);

		//getter
		const String&	fileName() const;
		void*			data();
		int32			width() const;
		int32			height() const;
		GLenum			format() const;
		GLenum			srcDataFormat() const;
		GLenum			srcDataType() const;
		int32			pixelSize() const;

		void			clear();

	protected:
		String		_fileName;
		void 		*_data;
		int32		_width;
		int32 		_height;
		// byte size of a pixel
		int32		_pixelSize;
		// format of the data (float or normal textures)
		GLenum		_format;
		// format of the souce data
		GLenum		_srcDataFormat;
		// type of the source data
		GLenum		_srcDataType;
	};

	// inline functions
	inline const String& Image::fileName() const {
		return _fileName;
	}

	inline void* Image::data() {
		return _data;
	}

	inline int32 Image::width() const {
		return _width;
	}

	inline int32 Image::height() const {
		return _height;
	}

	inline GLenum Image::format() const {
		return _format;
	}

	inline GLenum Image::srcDataFormat() const {
		return _srcDataFormat;
	}

	inline GLenum Image::srcDataType() const {
		return _srcDataType;
	}

	inline int32 Image::pixelSize() const {
		return _pixelSize;
	}

}